package happyhouse.ui.editors;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.wb.swt.layout.grouplayout.GroupLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.wb.swt.layout.grouplayout.LayoutStyle;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Table;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.swt.widgets.Control;

public class Income extends EditorPart {

	public static final String ID = "happyhouse.ui.editors.Income"; //$NON-NLS-1$
	private Text text;
	private Text text_1;
	private Text text_2;
	private Text text_3;
	private Text text_4;
	private Text text_5;
	private Table table;

	public Income() {
	}

	/**
	 * Create contents of the editor part.
	 * @param parent
	 */
	@Override
	public void createPartControl(Composite parent) {
		Composite container = new Composite(parent, SWT.NONE);
		
		Label lblMHan = new Label(container, SWT.NONE);
		lblMHan.setText("M\u00E3 h\u00F3a \u0111\u01A1n");
		
		text = new Text(container, SWT.BORDER);
		
		Label lblNgyHan = new Label(container, SWT.NONE);
		lblNgyHan.setText("Ng\u00E0y h\u00F3a \u0111\u01A1n");
		
		DateTime dateTime = new DateTime(container, SWT.BORDER);
		
		Label lblNgiThcHin = new Label(container, SWT.NONE);
		lblNgiThcHin.setText("Ng\u01B0\u1EDDi th\u1EF1c hi\u1EC7n");
		
		Combo combo = new Combo(container, SWT.NONE);
		
		Label lblLoiTin = new Label(container, SWT.NONE);
		lblLoiTin.setText("Lo\u1EA1i ti\u1EC1n");
		
		Combo combo_1 = new Combo(container, SWT.NONE);
		
		Label lblLoiHan = new Label(container, SWT.NONE);
		lblLoiHan.setText("Lo\u1EA1i h\u00F3a \u0111\u01A1n");
		
		Combo combo_2 = new Combo(container, SWT.NONE);
		combo_2.setItems(new String[] {"Thu", "Thu l\u01B0\u01A1ng th\u00E1ng", "Ti\u1EC1n l\u00E0m th\u00EAm gi\u1EDD", "Ti\u1EC1n th\u01B0\u1EDFng"});
		
		Label lblDinGii = new Label(container, SWT.NONE);
		lblDinGii.setText("Di\u1EC5n gi\u1EA3i");
		
		text_1 = new Text(container, SWT.BORDER);
		
		Label lblSTin = new Label(container, SWT.NONE);
		lblSTin.setText("S\u1ED1 ti\u1EC1n");
		
		text_2 = new Text(container, SWT.BORDER);
		
		Label lblTinQuyi = new Label(container, SWT.NONE);
		lblTinQuyi.setText("Ti\u1EC1n quy \u0111\u1ED5i");
		
		text_3 = new Text(container, SWT.BORDER);
		
		Label lblTinThu = new Label(container, SWT.NONE);
		lblTinThu.setText("Ti\u1EC1n thu\u1EBF");
		
		text_4 = new Text(container, SWT.BORDER);
		
		Label lblTinThuQuy = new Label(container, SWT.NONE);
		lblTinThuQuy.setText("Ti\u1EC1n thu\u1EBF quy \u0111\u1ED5i");
		
		text_5 = new Text(container, SWT.BORDER);
		
		Label lblKhngng = new Label(container, SWT.NONE);
		lblKhngng.setText("Kh\u00F4ng \u0111\u1ED3ng");
		
		Label lblKhngng_1 = new Label(container, SWT.NONE);
		lblKhngng_1.setText("Kh\u00F4ng \u0111\u1ED3ng");
		
		Group grpHnhng = new Group(container, SWT.NONE);
		grpHnhng.setText("H\u00E0nh \u0111\u1ED9ng");
		
		Composite composite = new Composite(container, SWT.NONE);
		composite.setLayout(new TableColumnLayout());
		
		TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
		table = tableViewer.getTable();
		table.setHeaderVisible(true);
		table.setLinesVisible(true);
		GroupLayout gl_container = new GroupLayout(container);
		gl_container.setHorizontalGroup(
			gl_container.createParallelGroup(GroupLayout.LEADING)
				.add(gl_container.createSequentialGroup()
					.add(gl_container.createParallelGroup(GroupLayout.LEADING)
						.add(gl_container.createSequentialGroup()
							.add(gl_container.createParallelGroup(GroupLayout.LEADING)
								.add(gl_container.createSequentialGroup()
									.add(16)
									.add(gl_container.createParallelGroup(GroupLayout.LEADING)
										.add(gl_container.createSequentialGroup()
											.add(lblMHan)
											.add(11)
											.add(text, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
											.add(19)
											.add(lblNgyHan)
											.add(10)
											.add(dateTime, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
										.add(gl_container.createSequentialGroup()
											.add(gl_container.createParallelGroup(GroupLayout.LEADING)
												.add(lblNgiThcHin)
												.add(lblLoiHan)
												.add(lblDinGii))
											.addPreferredGap(LayoutStyle.UNRELATED)
											.add(gl_container.createParallelGroup(GroupLayout.LEADING)
												.add(combo_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
												.add(gl_container.createSequentialGroup()
													.add(combo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
													.add(18)
													.add(lblLoiTin)
													.add(18)
													.add(combo_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
												.add(gl_container.createParallelGroup(GroupLayout.TRAILING)
													.add(lblKhngng)
													.add(text_1, GroupLayout.PREFERRED_SIZE, 280, GroupLayout.PREFERRED_SIZE))))))
								.add(gl_container.createSequentialGroup()
									.addContainerGap()
									.add(gl_container.createParallelGroup(GroupLayout.LEADING)
										.add(lblSTin)
										.add(lblTinThu))
									.add(26)
									.add(gl_container.createParallelGroup(GroupLayout.LEADING)
										.add(text_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
										.add(text_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
									.add(33)
									.add(gl_container.createParallelGroup(GroupLayout.LEADING)
										.add(gl_container.createSequentialGroup()
											.add(lblTinThuQuy)
											.addPreferredGap(LayoutStyle.UNRELATED)
											.add(text_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
											.addPreferredGap(LayoutStyle.RELATED)
											.add(lblKhngng_1))
										.add(gl_container.createSequentialGroup()
											.add(lblTinQuyi)
											.addPreferredGap(LayoutStyle.UNRELATED)
											.add(text_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))))
							.addPreferredGap(LayoutStyle.RELATED, 28, Short.MAX_VALUE)
							.add(grpHnhng, GroupLayout.PREFERRED_SIZE, 149, GroupLayout.PREFERRED_SIZE))
						.add(gl_container.createSequentialGroup()
							.addContainerGap()
							.add(composite, GroupLayout.DEFAULT_SIZE, 576, Short.MAX_VALUE)))
					.addContainerGap())
		);
		gl_container.setVerticalGroup(
			gl_container.createParallelGroup(GroupLayout.LEADING)
				.add(gl_container.createSequentialGroup()
					.add(gl_container.createParallelGroup(GroupLayout.LEADING)
						.add(gl_container.createSequentialGroup()
							.add(gl_container.createParallelGroup(GroupLayout.LEADING)
								.add(gl_container.createSequentialGroup()
									.add(12)
									.add(gl_container.createParallelGroup(GroupLayout.LEADING)
										.add(lblNgyHan)
										.add(lblMHan)))
								.add(gl_container.createSequentialGroup()
									.addContainerGap()
									.add(text, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
							.add(20)
							.add(gl_container.createParallelGroup(GroupLayout.BASELINE)
								.add(lblNgiThcHin)
								.add(combo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
								.add(lblLoiTin)
								.add(combo_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
							.add(18)
							.add(gl_container.createParallelGroup(GroupLayout.BASELINE)
								.add(lblLoiHan)
								.add(combo_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
							.add(34)
							.add(lblDinGii)
							.add(37)
							.add(gl_container.createParallelGroup(GroupLayout.BASELINE)
								.add(lblSTin)
								.add(text_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
								.add(lblTinQuyi)
								.add(text_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
							.add(18)
							.add(gl_container.createParallelGroup(GroupLayout.TRAILING)
								.add(lblTinThu)
								.add(gl_container.createParallelGroup(GroupLayout.BASELINE)
									.add(text_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
									.add(lblTinThuQuy)
									.add(text_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
									.add(lblKhngng_1))))
						.add(gl_container.createSequentialGroup()
							.add(9)
							.add(gl_container.createParallelGroup(GroupLayout.LEADING)
								.add(grpHnhng, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)
								.add(gl_container.createSequentialGroup()
									.add(dateTime, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
									.add(98)
									.add(text_1, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE)
									.add(18)
									.add(lblKhngng)))))
					.add(18)
					.add(composite, GroupLayout.PREFERRED_SIZE, 218, GroupLayout.PREFERRED_SIZE)
					.add(32))
		);
		
		Button btnThmMi = new Button(grpHnhng, SWT.NONE);
		btnThmMi.setBounds(35, 25, 68, 23);
		btnThmMi.setText("Th\u00EAm m\u1EDBi");
		
		Button btnSa = new Button(grpHnhng, SWT.NONE);
		btnSa.setBounds(35, 54, 68, 23);
		btnSa.setText("S\u1EEDa");
		
		Button btnLu = new Button(grpHnhng, SWT.NONE);
		btnLu.setBounds(35, 91, 68, 23);
		btnLu.setText("L\u01B0u");
		
		Button btnXa = new Button(grpHnhng, SWT.NONE);
		btnXa.setBounds(35, 120, 68, 23);
		btnXa.setText("X\u00F3a");
		
		Button btnLmTi = new Button(grpHnhng, SWT.NONE);
		btnLmTi.setBounds(35, 147, 68, 23);
		btnLmTi.setText("L\u00E0m t\u01B0\u01A1i");
		
		Button btnng = new Button(grpHnhng, SWT.NONE);
		btnng.setBounds(35, 183, 68, 23);
		btnng.setText("\u0110\u00F3ng");
		container.setLayout(gl_container);
		container.setTabList(new Control[]{dateTime, combo, combo_1, combo_2, text_1, text_2, text_3, text, text_4, text_5, grpHnhng, composite});

	}

	@Override
	public void setFocus() {
		// Set the focus
	}

	@Override
	public void doSave(IProgressMonitor monitor) {
		// Do the Save operation
	}

	@Override
	public void doSaveAs() {
		// Do the Save As operation
	}

	@Override
	public void init(IEditorSite site, IEditorInput input)
			throws PartInitException {
		// Initialize the editor part
	}

	@Override
	public boolean isDirty() {
		return false;
	}

	@Override
	public boolean isSaveAsAllowed() {
		return false;
	}
}
